import React, { Component } from 'react';
import "./seckill.css"
import service from '../../../../api';

interface Props{
    
}
interface State {
    seclist:any[]
    
}
// interface secItem {
//     pic:string
//     price:string
// }
class index extends Component <Props,State>{
    constructor(props:Props){
        super(props);
        this.state={
            seclist:[ ]
        }
    }
    // 发请求获取秒杀列表
    async componentDidMount(){
        var res = await service.product.pro_seckilllist({})
        console.log(res.data);
        this.setState({seclist:res.data.data})
        
    }
    render() {
        return (
            <div className='seckill'>
                <div className='top'>
                    <div className='left'>
                        <span className='hai'>嗨购秒杀</span>
                        <span className='eight'>18点场</span>
                    </div>
                    <div className='right'>
                        <span className='bao'>爆款轮番秒</span>
                    </div>
                </div>
                <div className='bottom'>
                {
                    this.state.seclist.map((item,index)=>{
                        return(
                            <div className="box" key={index}>
                                <img src={item.img1} alt="" />
                                <p className='price'>￥{item.originprice}</p>
                            </div>
                        )
                    })
                }
                </div>
            
            
        </div>
            
        );
    }
}


export default index;